//
//  MagazineTableViewCell.m
//  ChineseCollegeStudentsNetwork
//
//  Created by 刘喆 on 2018/5/21.
//  Copyright © 2018年 刘喆. All rights reserved.
//

#import "MagazineTableViewCell.h"

@implementation MagazineTableViewCell



#pragma mark - Init
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self createSubviews];
    }
    return self;
}

#pragma mark - Subviews
#pragma amrk layout subviews
- (void)layoutSubviewsInView {
    [_leftimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(120);
        make.height.mas_equalTo (160);
        
    }];
    [_titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(12);
        make.left.mas_equalTo(150);
        make.width.mas_equalTo(kDeviceWidth/3*2);
    }];
    [_timeL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.titleL.mas_left);
        make.width.mas_equalTo(self.titleL.mas_width);
        make.top.mas_equalTo(self.titleL.mas_bottom).offset(12);
    }];
    [_freeReadingnumL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.timeL.mas_left);
        make.width.mas_equalTo(self.timeL.mas_width);
        make.top.mas_equalTo(self.timeL.mas_bottom).offset(12);
    }];
    [_payReadingnumL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.freeReadingnumL.mas_left);
        make.width.mas_equalTo(self.freeReadingnumL.mas_width);
        make.top.mas_equalTo(self.freeReadingnumL.mas_bottom).offset(12);
    }];
    [_purchaseL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.payReadingnumL.mas_left);
        make.width.mas_equalTo(self.payReadingnumL.mas_width);
        make.top.mas_equalTo(self.payReadingnumL.mas_bottom).offset(12);
    }];
    [_ReadL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.purchaseL.mas_left);
        make.width.mas_equalTo(self.purchaseL.mas_width);
        make.top.mas_equalTo(self.purchaseL.mas_bottom).offset(12);
    }];

    
}

#pragma mark create subviews
- (void)createSubviews {
    [self.contentView addSubview:self.leftimg];
    [self.contentView addSubview:self.titleL];
    [self.contentView addSubview:self.timeL];
    [self.contentView addSubview:self.freeReadingnumL];
    [self.contentView addSubview:self.payReadingnumL];
    [self.contentView addSubview:self.purchaseL];
    [self.contentView addSubview:self.ReadL];    
    
    [self layoutSubviewsInView];
}

- (UIImageView *)leftimg {
    if (!_leftimg) {
        _leftimg = [[UIImageView alloc] init];
    }
    return _leftimg;
}

- (UILabel *)titleL {
    if (!_titleL) {
        _titleL = [[UILabel alloc] init];
        _titleL.textColor = kRGB(153, 153, 153, 1);
        _titleL.text = @"";
        _titleL.font = [UIFont systemFontOfSize:14];
    }
    return _titleL;
}

- (UILabel *)timeL {
    if (!_timeL) {
        _timeL = [[UILabel alloc] init];
        _timeL.textColor = kRGB(153, 153, 153, 1);
        _timeL.text = @"上架时间";
        _timeL.font = [UIFont systemFontOfSize:12];
    }
    return _timeL;
}
- (UILabel *)freeReadingnumL {
    if (!_freeReadingnumL) {
        _freeReadingnumL = [[UILabel alloc] init];
        _freeReadingnumL.textColor = kRGB(153, 153, 153, 1);
        _freeReadingnumL.text = @"免费阅读篇数：";
        _freeReadingnumL.font = [UIFont systemFontOfSize:12];
    }
    return _freeReadingnumL;
}
- (UILabel *)payReadingnumL {
    if (!_payReadingnumL) {
        _payReadingnumL = [[UILabel alloc] init];
        _payReadingnumL.textColor = kRGB(153, 153, 153, 1);
        _payReadingnumL.text = @"付费阅读篇数：";
        _payReadingnumL.font = [UIFont systemFontOfSize:12];
    }
    return _payReadingnumL;
}
- (UILabel *)purchaseL {
    if (!_purchaseL) {
        _purchaseL = [[UILabel alloc] init];
        _purchaseL.textColor = kRGB(153, 153, 153, 1);
        _purchaseL.text = @"纸质购买价格：";
        _purchaseL.font = [UIFont systemFontOfSize:12];
    }
    return _purchaseL;
}
- (UILabel *)ReadL {
    if (!_ReadL) {
        _ReadL = [[UILabel alloc] init];
        _ReadL.textColor = kRGB(153, 153, 153, 1);
        _ReadL.text = @"全刊电子阅读价格:";
        _ReadL.font = [UIFont systemFontOfSize:12];
    }
    return _ReadL;
}


@end
